import { defineComponent, ref } from "vue";

const JSXComponent = defineComponent({
  setup() {
    const title = ref("JSX in Vue3");
    const showText = ref(true);
    const list = [
      { id: 1, name: "Item 1" },
      { id: 2, name: "Item 2" },
      { id: 3, name: "Item 3" },
    ];

    return {
      title,
      showText,
      list,
    };
  },
  render() {
    return (
      <div style={{ background: "#000" }}>
        <h1>{this.title}</h1>
        {this.showText && <p>This is a demo text.</p>}
        <ul>
          {this.list.map((item) => (
            <li key={item.id}>{item.name}</li>
          ))}
        </ul>
      </div>
    );
  },
});

export default JSXComponent;
